package test.com.sms.selenium.singlepoint.util;

import org.openqa.selenium.By;

import test.com.sms.selenium.util.SeleniumUtil;

public class SpAssetsNewPageUtil {

	public final static By ASN_SPAN_HEADER_TITLE  	= By.id("AssetHdr1_lblHdr");
	public final static By ASN_LINK_SAVE  				= By.id("AssetHdr1_btnSave");
	public final static By ASN_LINK_CLOSE  				= By.id("AssetHdr1_btnDone");
	public final static By ASN_SPAN_MSG  				= By.id("AssetHdr1_lblMsg");
	public final static By ASN_TD_ASSET_NAME			= By.xpath("//*[@id='form1']/table/tbody/tr/td/table[2]/tbody/tr[1]/td[1]");
	public final static By ASN_INPUT_ASSET_NAME   	= By.id("AssetHdr1_txtAssetName");
	public final static By ASN_TD_SERIAL_NUM			= By.id("AssetHdr1_tdSerialNumLbl");
	public final static By ASN_INPUT_SERIAL_NUM		= By.id("AssetHdr1_txtSerialNumber");
	public final static By ASN_TD_DESC						= By.xpath("//*[@id='form1']/table/tbody/tr/td/table[2]/tbody/tr[1]/td[5]");
	public final static By ASN_INPUT_DESC				= By.id("AssetHdr1_txtDescription");
	public final static By ASN_TD_MFG_NAME			= By.xpath("//*[@id='form1']/table/tbody/tr/td/table[2]/tbody/tr[2]/td[1]");
	public final static By ASN_SELECT_MFG_NAME     = By.id("AssetHdr1_cboMfgCodeID");
	public final static By ASN_TD_MODEL					= By.xpath("//*[@id='form1']/table/tbody/tr/td/table[2]/tbody/tr[2]/td[3]");
	public final static By ASN_SELECT_MODEL   			=By.id("AssetHdr1_cboModelCodeID");
	public final static By ASN_TD_RHC						= By.xpath("//*[@id='form1']/table/tbody/tr/td/table[2]/tbody/tr[2]/td[5]");
	public final static By ASN_CHECKBOX_RHC    		= By.id("AssetHdr1_chkReqHWContract");
	public final static By ASN_TD_ASSET_TYPE			= By.xpath("//*[@id='form1']/table/tbody/tr/td/table[2]/tbody/tr[3]/td[1]");
	public final static By ASN_SELECT_ASSET_TYPE		= By.id("AssetHdr1_cboAssetTypeID");
	public final static By ASN_TD_SUB_TYPE				= By.xpath("//*[@id='form1']/table/tbody/tr/td/table[2]/tbody/tr[3]/td[3]");
	public final static By ASN_SELECT_SUB_TYPE			= By.id("AssetHdr1_cboAssetSubTypeID");
	public final static By ASN_TD_RSC						= By.xpath("//*[@id='form1']/table/tbody/tr/td/table[2]/tbody/tr[3]/td[5]");
	public final static By ASN_RADIO_RSC					= By.id("AssetHdr1_chkReqSWContract");
	public final static By ASN_TD_VIRTUAL				= By.xpath("//*[@id='form1']/table/tbody/tr/td/table[2]/tbody/tr[4]/td[3]");
	public final static By ASN_CHECKBOX_VIRTUAL	= By.id("AssetHdr1_chkVirtualFlag");
	public final static By ASN_TD_SP							= By.xpath("//*[@id='form1']/table/tbody/tr/td/table[2]/tbody/tr[4]/td[5]");
	public final static By ASN_TH_ASSET					= By.xpath("//*[@id='AssetHdr1_DashboardAssetCoverage_lblOutput']/table/tbody/tr[1]/th[1]");
	public final static By ASN_TH_CONTRACT			= By.xpath("//*[@id='AssetHdr1_DashboardAssetCoverage_lblOutput']/table/tbody/tr[1]/th[2]");
	public final static By ASN_TH_SP							= By.xpath("//*[@id='AssetHdr1_DashboardAssetCoverage_lblOutput']/table/tbody/tr[1]/th[3]");
	public final static By ASN_TH_WARR					= By.xpath("//*[@id='AssetHdr1_DashboardAssetCoverage_lblOutput']/table/tbody/tr[1]/th[4]");
	public final static By ASN_TH_ASSET_NAME			= By.xpath("//*[@id='AssetHdr1_DashboardAssetCoverage_lblOutput']/table/tbody/tr[2]/th[1]");
	public final static By ASN_TH_ASSET_SN				= By.xpath("//*[@id='AssetHdr1_DashboardAssetCoverage_lblOutput']/table/tbody/tr[2]/th[2]");
	public final static By ASN_TH_ASSET_MF				= By.xpath("//*[@id='AssetHdr1_DashboardAssetCoverage_lblOutput']/table/tbody/tr[2]/th[3]");
	public final static By ASN_TH_ASSET_ADESC			= By.xpath("//*[@id='AssetHdr1_DashboardAssetCoverage_lblOutput']/table/tbody/tr[2]/th[4]");
	public final static By ASN_TH_CONTRACT_ID		= By.xpath("//*[@id='AssetHdr1_DashboardAssetCoverage_lblOutput']/table/tbody/tr[2]/th[5]");
	public final static By ASN_TH_CONTRACT_LINE	= By.xpath("//*[@id='AssetHdr1_DashboardAssetCoverage_lblOutput']/table/tbody/tr[2]/th[6]");
	public final static By ASN_TH_CONTRACT_START	= By.xpath("//*[@id='AssetHdr1_DashboardAssetCoverage_lblOutput']/table/tbody/tr[2]/th[7]");
	public final static By ASN_TH_CONTRACT_CEND	= By.xpath("//*[@id='AssetHdr1_DashboardAssetCoverage_lblOutput']/table/tbody/tr[2]/th[8]");
	public final static By ASN_TH_CONTRACT_SLA		= By.xpath("//*[@id='AssetHdr1_DashboardAssetCoverage_lblOutput']/table/tbody/tr[2]/th[9]");
	public final static By ASN_TH_SP_CONTRACT		= By.xpath("//*[@id='AssetHdr1_DashboardAssetCoverage_lblOutput']/table/tbody/tr[2]/th[10]");
	public final static By ASN_TH_SP_START				= By.xpath("//*[@id='AssetHdr1_DashboardAssetCoverage_lblOutput']/table/tbody/tr[2]/th[11]");
	public final static By ASN_TH_SP_END					= By.xpath("//*[@id='AssetHdr1_DashboardAssetCoverage_lblOutput']/table/tbody/tr[2]/th[12]");
	public final static By ASN_TH_SP_SLA					= By.xpath("//*[@id='AssetHdr1_DashboardAssetCoverage_lblOutput']/table/tbody/tr[2]/th[13]");
	public final static By ASN_TH_WARR_START			= By.xpath("//*[@id='AssetHdr1_DashboardAssetCoverage_lblOutput']/table/tbody/tr[2]/th[14]");
	public final static By ASN_TH_WARR_END			= By.xpath("//*[@id='AssetHdr1_DashboardAssetCoverage_lblOutput']/table/tbody/tr[2]/th[15]");
	public static void assetsNewPageEnter(){
		SpHomePageUtil.enter();
		SeleniumUtil.click(SpHomePageUtil.getMainMenuAssets());
		SeleniumUtil.waitOnElements(new By[]{SpHomePageUtil.HOME_SUB_MENU_AST_NEW});
		SeleniumUtil.click(SpHomePageUtil.getAssetsNew());
		SeleniumUtil.waitForFixedMilliseconds(1000);
		waitForAssetsNewPageToLoad();
	}
	public static void waitForAssetsNewPageToLoad(){
		//asset search page in content area
		SeleniumUtil.selectDefaultContent();
		SeleniumUtil.selectFrame(SpHomePageUtil.HOME_FRAME_CONTENT_NAME);
		SeleniumUtil.waitOnElements(new By[]{
				ASN_LINK_SAVE, ASN_LINK_CLOSE, ASN_INPUT_ASSET_NAME, ASN_INPUT_SERIAL_NUM, ASN_INPUT_DESC, ASN_SELECT_MFG_NAME,
				ASN_SELECT_MODEL, ASN_CHECKBOX_RHC, ASN_SELECT_ASSET_TYPE, ASN_SELECT_SUB_TYPE, ASN_RADIO_RSC, ASN_CHECKBOX_VIRTUAL
			});
	}
}
